package com.securityLearn.securityAuth.service.impl;

import com.securityLearn.securityAuth.service.UserApi;
import com.securityLearn.securityAuth.service.entity.UserDto;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 查询用户（模拟查询数据库）
 * @author duzq
 * @date 2021-09-04 14:00:46
 */
@Service
public class UserApiImpl implements UserApi {

    @Override
    public UserDto getUserByUserName(String userName) {
        return userMap.get(userName);
    }


    /**
     * 初始化用户信息
     */
    private Map<String, UserDto> userMap = new HashMap<>(2);

    {
        userMap.put("zhangsan", new UserDto("1010", "zhangsan", "123",
                "张三", "133443"));
        userMap.put("lisi", new UserDto("1011", "lisi", "456",
                "李四", "144553"));
    }
}
